<%@ page language="java"  pageEncoding="UTF-8"%>
<%@page import="com.fick.hibernate.model.Media"%>
<%@page import="com.fick.hibernate.dao.MediaDAO"%>
<%@page import="com.fick.hibernate.model.Mediaclass"%>
<%@page import="com.fick.hibernate.dao.MediaclassDAO"%>
<%@page import="java.util.List"%>
<%@page import="java.io.*" %>
		<table width="260" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td height="36" align="right" valign="middle"
						background="images/left_top2.gif">
						<table border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td class="right_dh1 right_dhwz1">
									视频
								</td>
								<td class="right_dh2">
									 <a href="media_list.jsp?siteid=<%=request.getParameter("siteid")%>"><img src="images/more.gif" width="36" height="13" /></a>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td height="183" align="center" valign="top"
						background="images/left_cent1.gif">
						<table width="250" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="4"></td>
							</tr>
						</table>
						
<%
	MediaDAO mediaDAO = new MediaDAO();
	List list=mediaDAO.findPage(1,1,"where and mediaStatus='1'  order by mediaOrder");
	if(list.size()>0)
	{
	Media media = (Media)list.get(0);
%>	
    <%
		if (media.getMediaUrl() != null) {
			String url = media.getMediaUrl();
			String type = url.substring(url.lastIndexOf("."), url.length());
			java.io.File mediaFile = new File(request.getSession().getServletContext().getRealPath("/")+url);
			
			if (mediaFile.exists() && (type.equals(".flv") || type.equals(".swf"))) {
	%>
		<script type="text/javascript">

			var swf_width=250
			var swf_height=220
			var texts=''
			var files='<%=url %>'
			var config='1:自动播放|1:连续播放|100:默认音量|0:控制栏位置|1:控制栏显示'
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
			document.write('<param name="movie" value="swf/vcastr2.swf"><param name="quality" value="high"><param name="BarPosition" value="1">');
			document.write('<param name="menu" value="0"><param name=wmode value="opaque"><param name="WMode" value="Transparent"><param name="Play" value="1"><param name="Loop" value="1"><param name="Quality" value="High"><param name="SAlign" value>');
			document.write('<param name="Base" value><param name="allowFullScreen" value="true" /><param name="IsShowBar" value="1"><param name="Scale" value="ShowAll"><param name="DeviceFont" value="1"><param name="EmbedMovie" value="1"><param name="BGColor" value><param name="SWRemote" value>');
			document.write('<param name="FlashVars" value="vcastr_file='+files+'&BarColor=0xFF6600&BarPosition=1">');
			document.write('<embed src="swf/vcastr2.swf" wmode="opaque" FlashVars="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'" menu="true" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>'); 
			</script>
		
	<%
			}
		}}
	%>		
						
					</td>
				</tr>
						
				<tr>
					<td height="3" background="images/left_bot1.gif"></td>
				</tr>
			</table>